package com.example.leetcode.leetcode;

/**
 * @author zht
 * @date 2021/1/14 9:32
 */
public class Solution9 {
    public static boolean isPalindrome(int x) {
        String s  = String.valueOf(x);
        if (s.length()==0){
            return false;
        }
        int left = (s.length()-1)/2;
        int right = left;
        if (s.length()%2==0){
            right = left+1;
        }
        while(left>=0&&right<s.length()){
            if(s.charAt(left)!=s.charAt(right)){
                return false;
            }
            left--;
            right++;
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(isPalindrome(-1324));
    }
}
